Persist the last cycle tick in emigration for a more consistent gameplay experience#1330
Conversation
fc1e7ce to
32abad9
Compare
|
I fixed the formatting of the "Fixes" line in the description so GitHub can understand it and link the issue properly |
changelog.txt
Outdated
There was a problem hiding this comment.
I'd categorize this as a "Fix" since it prevents the undesired behavior of artificially increased rate of emigration
emigration.lua
Outdated
There was a problem hiding this comment.
please add named constants instead of magic numbers. example:
scripts/agitation-rebalance.lua
Lines 335 to 337 in 80e1a98
note to self: we really really need to fix up and merge DFHack/dfhack#3907
emigration.lua
Outdated
There was a problem hiding this comment.
this will leave last_cycle_tick as nil in current games with saved state. It would be better to normalize the value here so you can remove the check for nil in event_loop.
I suggest a pattern like this:
state = get_default_state()
utils.assign(state, dfhack.persistent.getSiteData(GLOBAL_KEY, state))
emigration.lua
Outdated
There was a problem hiding this comment.
now that we have more than just enabled here, I suggest making this clearer by putting the state in a table.
local function get_default_state()
return {enabled=false, last_cycle_tick=0}
end
state = state or get_default_state()2dd967a to
db847ce
Compare
…consistent with respect to save-and-reloads
db847ce to
536edcf
Compare
|
Tested and works |
myk002
left a comment
There was a problem hiding this comment.
Just to mention, GitHub loses review state when you force push, so it's easier to review if you leave the commits separate. That is, if you force-push, I lose all review state and have to review from scratch. You can squash at the very end if you want to, but it's not necessary.
Fixes: DFHack/dfhack#5011